from google.appengine.ext import db

# Site settings,
class Site(db.Expando):
  title = db.StringProperty()

# The permissions describe what operations exist
class Permission(db.Model):
  title = db.StringProperty()

# Role-based access control is the underlying principle
class Role(db.Model):
  title = db.StringProperty()
  permissions = db.ListProperty(db.Key) # the permissions this role has

# To store more user specific data
class ExtendUser(db.Model):
  user = db.UserProperty() # the actual user reference
  nick = db.StringProperty() # the nickname that will be displayed
  description = db.TextProperty() # a selfdescription
  date = db.DateTimeProperty(auto_now_add=True) # joined at that time
  url_slug = db.StringProperty() # unique url
  roles = db.ListProperty(db.Key) # the roles the user is in

# Page objects store the actual content
class Page(db.Model):
  author = db.ReferenceProperty(ExtendUser)
  title = db.StringProperty()
  text = db.TextProperty()
  date = db.DateTimeProperty(auto_now_add=True)
  url_slug = db.StringProperty()

